package com.carhailing.auth.controller;

import com.carhailing.auth.service.AuthService;
import com.carhailing.common.domain.response.TokenDto;
import com.carhailing.common.domain.response.SysUserDto;
import com.carhailing.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author：作者姓名
 * @Package：com.mj.auth.controller
 * @Project：g5_zuoye14
 * @name：Auth
 * @Date：2024/5/9 17:27
 */
@RestController
@RequestMapping("/authUser")
public class AuthController {
    @Autowired
    private AuthService authService;

//    @GetMapping("getcode")
//    public Result<SysUserDto> getcode(@RequestParam String name){
//        Result<SysUserDto> userResult = authService.getcode(name);
//        return userResult;
//    }

    @PostMapping("dologin")
    public Result<TokenDto> dologin(@RequestBody SysUserDto user){
        Result<TokenDto> userResult = authService.dologin(user);
        return userResult;
    }

    @GetMapping("info")
    public Result<SysUserDto> info(){
        Result<SysUserDto> userResult = authService.info();
        return userResult;
    }
}
